@extends('layouts._app')
@section('content')
    <link rel="stylesheet" type="text/css" href="{{asset('static/markdown/css/editormd.css')}}"/>
    <body class="iframe-h">
    <div class="email-write">
        @include('layouts._flash')
        <div class="layui-form-item">
            <label class="layui-form-label">文章标题：</label>
            <div class="layui-input-block">
                {!! Form::text('',"{$article->title}",['readonly','class'=>'layui-input']) !!}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文章简介：</label>
            <div class="layui-input-block">
                {!! Form::textarea('',"{$article->content->intro}",['readonly','class'=>'layui-textarea']) !!}
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">文章内容：</label>
            <div id="laymd-dome">
                @if($user->info->editor == 1)
                    {!! Form::textarea('',"{$article->content->markdown}",['readonly','class'=>'layui-textarea','style'=>'display:none;']) !!}
                    <script src="{{asset('js/jquery.min.js')}}"></script>
                    <script src="{{asset('static/markdown/lib/marked.min.js')}}"></script>
                    <script src="{{asset('static/markdown/lib/prettify.min.js')}}"></script>
                    <script src="{{asset('static/markdown/lib/raphael.min.js')}}"></script>
                    <script src="{{asset('static/markdown/lib/underscore.min.js')}}"></script>
                    <script src="{{asset('static/markdown/lib/sequence-diagram.min.js')}}"></script>
                    <script src="{{asset('static/markdown/lib/flowchart.min.js')}}"></script>
                    <script src="{{asset('static/markdown/lib/jquery.flowchart.min.js')}}"></script>
                    <script src="{{asset('static/markdown/editormd.js')}}"></script>
                    <script>
                        $(document).ready(function () {
                            editormd.markdownToHTML("laymd-dome", {
                                htmlDecode: "style,script,iframe",  // you can filter tags decode
                                emoji: true,
                                taskList: true,
                                tex: true,  // 默认不解析
                                flowChart: true,  // 默认不解析
                                sequenceDiagram: true,  // 默认不解析
                                tocm: true,//菜单
                                tocContainer: "",
                                tocDropdown: false
                            });

                        })
                    </script>
                @else
                    {!! $article->content->html !!}
                @endif
            </div>
            <p id="output"></p>
        </div>
        <div class="layui-form-item">
            <a href="{{route('blog.article.index')}}" class="layui-btn layui-btn-primary"><i
                    class="layui-icon">&#x1006;</i> 返回</a>
        </div>
    </div>
    </body>
@endsection
